import React, { Component } from "react";

import { Select } from "antd";
import { Option } from "antd/lib/mentions";
//频道API
import { getChannelListAPI } from "api/channel";

export default class Channel extends Component {
  state = {
    channelList: [],
  };
  async componentDidMount() {
    const res = await getChannelListAPI();
    this.setState({
      channelList: res.data.channels,
    });
  }
  render() {
    const { channelList } = this.state;
    return (
      <div>
        <Select style={{ width: 220 }} {...this.props}>
          {this.props.isdf || <Option value={-1}>全部</Option>}
          {channelList.map((item) => (
            <Select value={item.id} key={item.id}>
              {item.name}
            </Select>
          ))}
        </Select>
      </div>
    );
  }
}
